<template>
  <RecordLink :value="contractNo"
              :link="router"
              :query="query"
              :target="target"
              :tag="tag"
              :copyable="copyable">
    <el-tooltip v-if="hasException"
                class="mr10"
                effect="dark"
                content="货物异常"
                placement="top">
      <icon-svg class-name="iconClass"
                icon-name="yichang" />
    </el-tooltip>
  </RecordLink>
</template>



<script>
import RecordLink from "@basic/RecordLink.vue"
export default {
  name: "WaybillContractLink",
  components: {
    RecordLink
  },
  props: {
    router: String,
    value: Object,
    target: String,
    copyable: Boolean,
  },
  computed: {
    waybill () {
      return this.value || {};
    },
    contractNo () {
      return this.waybill.contractNo;
    },
    query () {
      return {
        id: this.waybill.id,
        status: this.waybill.status,
      }
    },
    tag () {
      if (this.waybill.divide) {
        return "拆";
      }
      if (this.waybill.combineContractNo) {
        return "合";
      }
    },
    hasException () {
      return this.waybill.goodsException;
    }
  }
}
</script>